#!/fs/home/chakkrit_ta/.local/bin/python
#!/usr/bin/python

# _*_ encoding: utf-8 _*_
import cgi
import cgitb
import xmlrpclib
import json
import os

if __name__ == '__main__' :
    print 'Content-type: text/html\n'
    cgitb.enable()
    form = cgi.FieldStorage()
    print '''
<html><head><title>The Webgraph Framework by klainfo</title></head>
<style>
a{ color:blue;
    text-decoration:none;
}
hr{
    margin-top:0; 
    background-color:blue; 
    border:0; 
    height:1;
}
</style>
<body>
<div style="font-size:14; text-align:left;">
<a href="http://tera.thaigrid.or.th]/~chakkrit_ta/webgraph">Home</a>
| <a href="http://wiki.klainfo.com/webgraph-api" >API</a>
| <a href="http://www.klainfo.com/">klainfo</a>
</div>
<hr>
<div id="main" style="margin-top:0px">
<center>
    <h1>Simple Webgraph</h1>
    <h3>Current snapshot = wbCt100Sep08</h3>
    <form method="get" action="api.py"><div style="font-size:30px;">
        <select name="service" style="width:200px;height:40px;font-size:30px;" >
            <option value="site">Site: </option>
            <option value="forward">Forward: </option>
            <option value="backward">Backward: </option>
        </select>
        <input name="urlrequest" style="width:535px;height:40px;font-size:30px;" value="http://">
        <input name="gui" value="true" type="hidden">
        <input type="submit" style="width:135px;height:40px;font-size:30px;" value="Submit"></div>
    </form>
    <form method="get" action="api.py"><div style="font-size:30px;">
        <select name="service" style="width:200px;height:40px;font-size:30px;" >
            <option value="urltoid">URL to ID : </option>
        </select>
        <input name="url" style="width:535px;height:40px;font-size:30px;" value="">
        <input name="gui" value="true" type="hidden">
        <input type="submit" style="width:135px;height:40px;font-size:30px;" value="Submit"></div>
    </form>
    <form method="get" action="api.py"><div style="font-size:30px;">
        <select name="service" style="width:200px;height:40px;font-size:30px;" >
            <option value="idtourl">ID to URL: </option>
        </select>
        <input name="id" style="width:535px;height:40px;font-size:30px;" value="">
        <input name="gui" value="true" type="hidden">
        <input type="submit" style="width:135px;height:40px;font-size:30px;" value="Submit"></div>
    </form>
    <form method="get" action="api.py"><div style="font-size:30px;">
        <select name="service" style="width:200px;height:40px;font-size:30px;" >
            <option value="downloadsite">Download: </option>
        </select>
        <input name="urlrequest" style="width:535px;height:40px;font-size:30px;" value="http://">
        <input name="gui" value="true" type="hidden">
        <input type="submit" style="width:135px;height:40px;font-size:30px;" value="Submit"></div>
    </form>
    <form method="get" action="api.py"><div style="font-size:30px;">
        <select name="value" style="width:355px;height:40px;font-size:30px;" >
            <option value="source">Source List : </option>
            <option value="destination">Destination List : </option>
        </select>
        <input name="maximum" style="width:135px;height:40px;font-size:30px;text-align:center;" value="10">
        <input name="service" value="list" type="hidden">
        <input name="gui" value="true" type="hidden">
        <input type="submit" style="width:135px;height:40px;font-size:30px;" value="Submit"></div>
    </form>
    <form method="get" action="api.py"><div style="font-size:30px;">
        <select name="filename" style="width:500px;height:40px;font-size:30px;" >
            <option value="webgraph">Download webgraph.bin</option>
            <option value="transposegraph">Download transposegraph.bin</option>
            <option value="danglingnode">Download danglingnode.bin</option>
        </select>
        <input name="service" value="download" type="hidden">
        <input name="gui" value="true" type="hidden">
        <input type="submit" style="width:135px;height:40px;font-size:30px;" value="Submit"></div>
    </form>
    <form method="get" action="api.py"><div style="font-size:30px;">
        <select name="" style="width:500px;height:40px;font-size:30px;" >
            <option value="">Show Statistics</option>
        </select>
        <input name="service" value="stat" type="hidden">
        <input name="gui" value="true" type="hidden">
        <input type="submit" style="width:135px;height:40px;font-size:30px;" value="Submit"></div>
    </form>

    <p><a href="http://twitter.com/klainfo">Contact @klainfo</a></p>
    <p><a href="http://wiki.klainfo.com/webgraph">Project Wiki</a></p>
    <p><a href="http://tera.thaigrid.or.th/">Powered by Tera Cluster.</a></p>
</center>
<hr style="margin-top:0">
</div>
</body></html>
'''
